﻿using System;

namespace RockBus.CacheManager.Interfaces
{
    public interface ICacheManager
    {
        void Add(string key, object value);

        void Add(string key, object value, int timeToLiveSecs);

        void Add<T>(string key, T value) where T : class;

        void Add<T>(string key, T value, int timeToLiveSecs) where T : class;

        object Get(string key);

        T Get<T>(string key) where T : class;

        object Remove(string key);

        T Remove<T>(string key) where T : class;

        void AutoAdd<T>(string key, Func<T> valueFactory, bool isThreadSafe) where T : class;

        void AutoAdd<T>(string key, Func<T> valueFactory, bool isThreadSafe, int timeToLiveSecs) where T : class;

        object AutoGet(string key);

        T AutoGet<T>(string key) where T : class;

        object AutoRemove(string key);

        T AutoRemove<T>(string key) where T : class;
    }
}